package com.aceitunaproject.shared.map;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import com.aceitunaproject.shared.gamelement.Installation;
import com.aceitunaproject.shared.gamelement.Settlement;
import com.aceitunaproject.shared.gamelement.Unit;

/**
 * Map tile Object
 * 
 * @author Sven Berger
 * @email admin@svchb.net
 * 
 */
public class MapTile implements Serializable {

	private static final long serialVersionUID = -8770067379053963412L;
	private int posx;
	private int posy;

	private List<Installation> installations = new LinkedList<Installation>();
	private List<Unit> units = new LinkedList<Unit>();
	private Settlement Settlement = null;
	private List<TerrainType> Terrain = new LinkedList<TerrainType>();

	public MapTile(List<TerrainType> terrain, List<Installation> constr,
			List<Unit> unit, Settlement set) {

		this.setTerrain(terrain);
		this.setInstallations(constr);
		this.setUnits(unit);
		this.setSettlement(set);
	}

	public MapTile() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param posx
	 *            sets the x position in the map of the map tile
	 */
	public void setPosx(int posx) {
		this.posx = posx;
	}

	/**
	 * @return the posx
	 */
	public int getPosx() {
		return posx;
	}

	/**
	 * @param posy
	 *            sets the y possition in the map of the map tile
	 */
	public void setPosy(int posy) {
		this.posy = posy;
	}

	/**
	 * @return the y position in the map of the map tile
	 */
	public int getPosy() {
		return posy;
	}

	/**
	 * @param units
	 *            the units currently in the map tile
	 */
	public void setUnits(List<Unit> units) {
		this.units = units;
	}

	/**
	 * @return the units units currently in the map tile
	 */
	public List<Unit> getUnits() {
		return units;
	}

	/**
	 * @param settlement
	 *            the settlement to set
	 */
	public void setSettlement(Settlement settlement) {
		Settlement = settlement;
	}

	/**
	 * @return the settlement
	 */
	public Settlement getSettlement() {
		return Settlement;
	}

	/**
	 * @param installations
	 *            the installations to set
	 */
	public void setInstallations(List<Installation> installations) {
		this.installations = installations;
	}

	/**
	 * @return the installations
	 */
	public List<Installation> getInstallations() {
		if (installations == null)
			installations = new LinkedList<Installation>();

		return installations;
	}

	/**
	 * @param terrain
	 *            the terrain to set
	 */
	public void setTerrain(List<TerrainType> terrain) {
		Terrain = terrain;
	}

	/**
	 * @return the terrain
	 */
	public List<TerrainType> getTerrain() {
		return Terrain;
	}

}
